<?php
/*
 * @Author: your name
 * @Date: 2020-11-10 13:44:09
 * @LastEditTime: 2020-12-17 11:05:44
 * @LastEditors: Please set LastEditors
 * @Description: 组织架构数据验证器
 * @FilePath: /special/application/adminapiv3/validate/MinistryValidate.php
 */

namespace app\adminapiv3\validate;


use think\Validate;

class MinistryValidate extends Validate
{
    //验证规则
    protected $rule = [
        //单位ID
        'id|组织ID' => 'require|integer|length:1,10',
        //组织名称
        'name|组织名称' => 'require|max:50',
        //上级组织ID
        'pid|上级组织ID' => 'require|integer|length:1,10',
    ];

    //错误信息
    protected $message = [
        //'name.unique' => '位置名称已存在',
    ];

    //验证场景
    protected $scene = [
        //添加
        'add' => ['name','pid'],

        'modify' => ['id','name'],
        //删除
        'del' => ['id'],
    ];

}